package org.finesys.chat.core.base.document.splitter;

import java.util.List;
import java.util.stream.Collectors;

import org.finesys.chat.core.base.document.Document;
import org.finesys.chat.core.base.segment.TextSegment;

public interface DocumentSplitter {
    List<TextSegment> split(Document document);

    default List<TextSegment> splitAll(List<Document> documents) {
        return (List<TextSegment>) documents.stream().flatMap((document) -> {
            return this.split(document).stream();
        }).collect(Collectors.toList());
    }
}
